<include file="Public/header" />
<title>添加账册</title>
</head>
<body>
<div class="pd-20">
<form class="" name="form" id="form" action="__URL__/index/" method="get">
	<table class="table table-border table-bordered table-bg">
		<input type="hidden" name="id" class="input-text" value="<{$detail.id}>">
		<tbody>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品编码</td>
				<td class="text-l" width="35%">
					<{$detail.goods_no}>
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品名称</td>
				<td class="text-l" width="35%">
					<{$detail.name}>
				</td>						
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品分类</td>
				<td class="text-l" width="35%">
					<{$detail.category}>
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">国家</td>
				<td class="text-l" width="35%">
					<{$detail.country}>
				</td>						
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">品名规则</td>
				<td class="text-l">
					<input type="text" name="rule_code" class="input-text" value="<{$detail.rule_code}>">
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">工厂</td>
				<td class="text-l">
					<select name="factory_rule_code" class="factory_rule_code">
					<option value="0">请选择</option>
					<foreach name="factory_list" item="vo">
						<option value="<{$vo.rule_code}>"><{$vo.name}></option>
					</foreach>
					</select>
				</td>						
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">级别</td>
				<td class="text-l">
					<select name="level_rule_code" class="level_rule_code">
					<option value="0">请选择</option>
					<foreach name="level_list" item="vs">
						<option value="<{$vs.rule_code}>"><{$vs.level}></option>
					</foreach>
					</select>
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5"></td>
				<td class="text-l">
					
				</td>						
			</tr>
		</tbody>
	</table>
	

	<input type="button" class="btn btn-primary radius mt" id="b_add" value="更新">
</form>
</div>
<script type="text/javascript">
    $(function(){
		/*保存计划入库单数据*/
        $("#b_add").click(function(){
			if($('.factory_rule_code').val()==0){
				layer.msg('工厂未选择');
				return false;
			}
			if($('.level_rule_code').val()==0){
				layer.msg('级别未选择');
				return false;
			}
			$.ajax({
                type: 'POST',
                data: $("#form").serialize(),
                url: "<{:U('add_product')}>",
                success:function(data){
                    layer.msg(data.info,function(){
						if(data.status==0){
							return false;
						}
						parent.window.location.href =parent.window.location.href;
					});
                }
            })
            
        });

    })
</script>
</body>
</html>